import { createStore } from 'vuex'
import vuexP from 'vuex-persistedstate'

export default createStore({
  plugins:[vuexP()],
  state: {
    list: []
  },
  getters: {
  },
  mutations: {
    //添加数据
    addVal(state, val) {
      let obj = {
        title: val,
        flag: false,
        id:new Date()
      }
      state.list.push(obj)
      
    },
    //改变状态
    changeCount(state,obj){
      let {status,index}=obj
      state.list[index].flag=status
      
    },
    //删除数据
    del(state,index){
      state.list.splice(index,1)
    }
  },
  actions: {
  },
  modules: {
  }
})
